package com.it.miniodemo.minio;

import io.minio.MinioClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class MinoConfig {
    @Bean
    @ConditionalOnMissingBean(MyMinioClient.class)
    public MyMinioClient MyMinioClientminioClient(MinioClient minioClient) {

        return new MyMinioClient(minioClient);
    }

    @Bean
    public MinioClient minioClient(MinioProperties minioProperty) {
        MinioClient minioClient = MinioClient.
                builder()
                .endpoint("http://119.91.64.46:9000")
                .credentials(minioProperty.getAccessKey(), minioProperty.getAccessSecret())
                .build();
        return minioClient;
    }
}
